<?php 
$CI =& get_instance();

$CI->load->database();
$CI->load->library("front/header_lib");

$page_title =  "Make a payment";

$query_pages = $CI->db->get_where('bur_staticpages',array('staticpage_link'=>'make_payment'));

foreach($query_pages->result() as $row_vals)
{
     $title = $row_vals->staticpage_title;
	$metakey_page = $row_vals->staticpage_metakey;
    $metadesc_page = $row_vals->staticpage_metadesc;  
}

$datas = array();

$CI->header_lib->display_header_element(array("script"=>array("jquery-1.4.2","jquery.validate"),"page_title"=>$title,"metakey_page"=>$metakey_page,"metadesc_page"=>$metadesc_page));
$CI->header_lib->display_header($datas);


?>
<!--body content starts-->

<div id="container_wrapper">
	<div id="body_container">
    	<div class="left_part">
        	Payment 
            <div class="div04">
            <p class="normal_text">Request a quote for printing instantly. Simply input the details and submit the form to us. We will get back to you within 24 hours with your quote.</p>
            <a class="readmore">our more agencies &gt;&gt;</a>
            </div>
             <div class="request_quote">
            
            </div>
        </div>
    	
        <div class="right_part">
        <!--payment starts here-->
        <div class="requrest_quote">
         <?php //, 'onsubmit' => 'return validateCard(\''.date("n").'\',\''.date("Y").'\');'
                $attributes = array('class' => '', 'id' => 'directPaymentForm' , 'name' => 'thefr');
                echo form_open('make-a-payment/payment',$attributes);
            ?>
            <ul>
            	<li>
                <div class="list_div01">&nbsp;</div>
                <div class="list_div02">
                	<h1 class="heading01">make a payment </h1>
                    <p class="redTxt">Make a payment online using our secure payment gateway. Simple fill in the detail below and submit.</p>
                </div>
                <div class="clear"></div>
                </li>
                <li>
                	<div class="list_div01">your name</div>
                    <div class="list_div02">
                    	<?php echo $name;?>
                    </div>
                    <div class="clear"></div>
                </li>
                <li>
                	<div class="list_div01">company</div>
                    <div class="list_div02">
                     	<?php echo $company;?>
                    </div>
                    <div class="clear"></div>
                </li>
                 <li>
                	<div class="list_div01">telephone</div>
                    <div class="list_div02">
                     	<?php echo $telephone;?>
                    </div>
                    <div class="clear"></div>
                </li>
                 <li>
                	<div class="list_div01">e-mail</div>
                    <div class="list_div02">
                     	<?php echo $email;?>
                    </div>
                    <div class="clear"></div>
                </li>
                 <li>
                	<div class="list_div01" style="width:129px; margin:0; text-align:left;">payment for</div>
                    <div class="list_div02">
                     	<?php echo $payment_for;?>
                    </div>
                    <div class="clear"></div>
                </li>
                 <li>
                	<div class="list_div01">amount</div>
                    <div class="list_div02">
                     	<?php echo $payment_amount;?>
                		<p style="display:block;">(Payment amount In South African Rands)</p>
                		<a href="http://finance.yahoo.com/currency-converter/#from=USD;to=EUR;amt=1" target="_blank">view currency converter</a>
                    </div>
                    <div class="clear"></div>
                </li>
                <li>
                	<div class="list_div01">Credit Card Payment</div>
                    <div class="list_div02">
                     	<div class="payment_method">
            				<ul>
                	<li>
                    	<div><strong>Your Credit Card details:</strong></div>
                        <div class="clear"></div>
                    </li>
                    <li> 
                    <div class="form_row">
                      <div class="form_label">Card Number<?php //echo val($creditCardNumber);?></div>
                      <div class="form_input">
                        <input style="width:235px; " type="text" class="width_275px" maxlength="19" name="creditCardNumber" id="creditCardNumber" value="<?=$creditCardNumber?>" />
                      </div>
                      <div id="creditCardNumber1" class="error_msg"></div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label">Card Holder</div>
                      <div class="form_input">
                        <input name="firstName" type="text" id="firstName" value="<?php echo (isset($_POST[firstName]))?$_POST[firstName]:$userObj->FirstName?>" size="15" maxlength="32" style="width:110px;" />
                        <input name="lastName" type="text" id="lastName" value="<?php echo (isset($_POST[lastName]))?$_POST[lastName]:$userObj->LastName?>" size="15" maxlength="32" style="width:110px;" />
                      </div>
                      <div id="firstname1" class="error_msg"></div>
                      <div id="lastname1" class="error_msg"></div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label">Card Type</div>
                      <div class="form_input">
                        <select name="creditCardType" id="creditCardType" style="width:250px;">
                          <option value="0" selected="selected">Card Type</option>
                          <option value="Visa" <?php if($creditCardType=='Visa'){echo "selected";}?>>Visa</option>
                          <option value="MasterCard" <?php if($creditCardType=='MasterCard'){echo "selected";}?>>MasterCard</option>
                          <option value="Discover" <?php if($creditCardType=='Discover'){echo "selected";}?>>Discover</option>
                          <option value="American Express" <?php if($creditCardType=='American Express'){echo "selected";}?>>American Express</option>
                        </select>
                      </div>
                      <div id="creditType" class="error_msg"></div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label">Budget</div>
                      <div style="height:5px;"></div>
                      <div class="form_input">
                        <input checked="checked" type="radio" name="radio" id="straight" value="0"/>
                        Straight
                        <input type="radio" name="radio" accept="<?php if($_POST['radio'] == 1){echo "checked";}?>" id="budget" value="1"/>
                        Budget</div>
                      <div id="budget1"></div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label">Budget Period:</div>
                      <div class="form_input">
                        <select name="budgetPeriod" id="budgetPeriod" style="width:250px;">
                          <option value="6 months">3 months</option>
                          <option value="12 months">6 months</option>
                          <option value="24 months">9 months</option>
                          <option value="12 months">12 months</option>
                          <option value="24 months">24 months</option>
                          <option value="36 months">36 months</option>
                          <option value="48 months">48 months</option>
                          <option value="60 months">60 months</option>
                        </select>
                      </div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label" style="width:250px;">Card Expiry Month</div>
                      <div class="form_input">
                        <select name="expDateMonth" id="expDateMonth" style="width:100px;">
                          <option value="1" <?php if($expDateMonth=='1'){echo "selected";}?>>01</option>
                          <option value="2" <?php if($expDateMonth=='2'){echo "selected";}?>>02</option>
                          <option value="3" <?php if($expDateMonth=='3'){echo "selected";}?>>03</option>
                          <option value="4" <?php if($expDateMonth=='4'){echo "selected";}?>>04</option>
                          <option value="5" <?php if($expDateMonth=='5'){echo "selected";}?>>05</option>
                          <option value="6" <?php if($expDateMonth=='6'){echo "selected";}?>>06</option>
                          <option value="7" <?php if($expDateMonth=='7'){echo "selected";}?>>07</option>
                          <option value="8" <?php if($expDateMonth=='8'){echo "selected";}?>>08</option>
                          <option value="9" <?php if($expDateMonth=='9'){echo "selected";}?>>09</option>
                          <option value="10" <?php if($expDateMonth=='10'){echo "selected";}?>>10</option>
                          <option value="11" <?php if($expDateMonth=='11'){echo "selected";}?>>11</option>
                          <option value="12" <?php if($expDateMonth=='12'){echo "selected";}?>>12</option>
                        </select>
                      </div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Card Expiry Year</div>
                      <div class="form_input">
                        <select name="expDateYear" id="expDateYear" style="width:250px;">
                          <?php 
                    
                    				$curYear = date('Y'); 
                    
                    				for($i=$curYear; $i<$curYear+10;$i++)
                    
                    				{
                    
                    			?>
                          <option value="<?php echo $i;?>" <?php echo($expDateYear==$i)?"selected":""?>><?php echo $i;?></option>
                          <?php
                    
                    				}
                    
                    			?>
                        </select>
                      </div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Card Verification Number:</div>
                      <div class="form_input">
                        <input  type="text" size="3" maxlength="4" name="cvv2Number2" style="width:235px; " id="cvv2Number" value="<?=$cvv2Number?>" />
                      </div>
                      <div id="csv" class="error_msg"></div>
                    </div>
                    </li>
                    <li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Confirmation E-mail:</div>
                      <div class="form_input">
                        
                        <input style="width:235px;" type="hidden" name="amount" value="<?php echo $payment_amount?>">
                        <input style="width:235px;" name="cemail" type="text" id="cemail" size="40"  value=""/>
                        <div id="cemail1" class="error_msg"></div>
                      </div>
                      <input type="hidden" name="orderid" value="<?php echo $orderid?>">
                      <input type="hidden" name="name" value="<?php echo $name?> ">
                      <input type="hidden" name="company" value="<?php echo $company?> ">
                      <input type="hidden" name="telephone" value="<?php echo $telephone?>">
                      <input type="hidden" name="email" value="<?php echo $email?>">
                      <input type="hidden" name="payfor" value="<?php echo $payment_for?>">
                      <input type="hidden" name="country" value="<?php echo $country?>">
                      <input type="hidden" name="paymentType" value="1">
                    </div>
                    </li>
                </ul>
                		</div>
                 	</div>
                     <div class="clear"></div>
                </li>
                <li>
                	<div class="list_div01">&nbsp;</div>
                    <div class="list_div02">
                    	<input type="image" name="submit_payment" id="submit_payment" src="images/submit_btn.jpg" height="57" width="378" style="border:1px solid #194C75" />
                    </div>
                    <div class="clear"></div>
                </li>
                </ul>
                <?php echo form_close();?>
        <!--payment ends here-->
            <?php /*?><div class="make_payment">
            <h2 class="head02">Make a payment to Mykprisguide now</h2>
            <div class="height10"></div>
            <p>Your payment details are as follows.</p>
            <div class="line6"></div>
            <div class="height10"></div>
            <ul>
            	<li>Your Name:</li>
                <li><p class="normal_txt5"><?php echo $name;?></p></li>
                <li>Company Name: </span></li>
                <li><p class="normal_txt5"><?php echo $company;?></p></li>
                <li>Telephone Number:</li>
                <li><p class="normal_txt5"><?php echo $telephone;?></p>
                </li>
                <li>E-mail Address: </li>
                <li><p class="normal_txt5"><?php echo $email;?></p></li>
                <li>Payment for: </li>
                <li><p class="normal_txt5"><?php echo $payment_for;?></p></li>
                <li>your Country: </li>
                <li><p class="normal_txt5"><?php echo $country; ?></p></li>
                <div class="height10"></div>
                <div class="line6"></div>
                <li> <h2 class="head02">Amount</h2> </li>
                 <li><p class="normal_txt5"><?php echo $payment_amount;?></p></li>
                <li><p>Payment amount (In South African Rands)</p>
                <a href="http://finance.yahoo.com/currency-converter/#from=USD;to=EUR;amt=1">view currency converter</a></li>
               
                <div class="line6"></div>
            </ul>
            <div class="height10"></div>
            
            <?php 
                $attributes = array('class' => '', 'id' => 'directPaymentForm' , 'name' => 'thefr', 'onsubmit' => 'return validateCard(\''.date("n").'\',\''.date("Y").'\');');
                echo form_open('make-a-payment/payment',$attributes);
            ?>
            <div class="payment_box_style">
            <div class="payment_method">
            	<h2 class="head02">Credit Card Payment</h2>
                <ul>
                	<li>
                    	<div style="width20px; float:left;">Your Credit Card details:</div>
                        <div class="clear"></div>
                    </li>
                    <li> 
                    <div class="form_row">
                      <div class="form_label">Card Number</div>
                      <div class="form_input">
                        <input type="text" class="width_275px;" maxlength="19" name="creditCardNumber" id="creditCardNumber" value="<?=$creditCardNumber?>" />
                      </div>
                      <div id="creditCardNumber1" class="error_msg"></div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label">Card Holder</div>
                      <div class="form_input">
                        <input name="firstName" type="text" id="firstName" value="<?php echo (isset($_POST[firstName]))?$_POST[firstName]:$userObj->FirstName?>" size="15" maxlength="32" style="width:110px;" />
                        <input name="lastName" type="text" id="lastName" value="<?php echo (isset($_POST[lastName]))?$_POST[lastName]:$userObj->LastName?>" size="15" maxlength="32" style="width:110px;" />
                      </div>
                      <div id="firstname1" class="error_msg"></div>
                      <div id="lastname1" class="error_msg"></div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label">Card Type</div>
                      <div class="form_input">
                        <select name="creditCardType" id="creditCardType">
                          <option value="0" selected="selected">Card Type</option>
                          <option value="Visa" <?php if($creditCardType=='Visa'){echo "selected";}?>>Visa</option>
                          <option value="MasterCard" <?php if($creditCardType=='MasterCard'){echo "selected";}?>>MasterCard</option>
                          <option value="Discover" <?php if($creditCardType=='Discover'){echo "selected";}?>>Discover</option>
                          <option value="American Express" <?php if($creditCardType=='American Express'){echo "selected";}?>>American Express</option>
                        </select>
                      </div>
                      <div id="creditType" class="error_msg"></div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label">Budget</div>
                      <div class="form_input">
                        <input checked="checked" type="radio" name="radio" id="straight" value="0"/>
                        Straight
                        <input type="radio" name="radio" accept="<?php if($_POST['radio'] == 1){echo "checked";}?>" id="budget" value="1"/>
                        Budget</div>
                      <div id="budget1"></div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label">Budget Period:</div>
                      <div class="form_input">
                        <select name="budgetPeriod" id="budgetPeriod">
                          <option value="6 months">3 months</option>
                          <option value="12 months">6 months</option>
                          <option value="24 months">9 months</option>
                          <option value="12 months">12 months</option>
                          <option value="24 months">24 months</option>
                          <option value="36 months">36 months</option>
                          <option value="48 months">48 months</option>
                          <option value="60 months">60 months</option>
                        </select>
                      </div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Card Expiry Month</div>
                      <div class="form_input">
                        <select name="expDateMonth" id="expDateMonth" style="width:100px;">
                          <option value="1" <?php if($expDateMonth=='1'){echo "selected";}?>>01</option>
                          <option value="2" <?php if($expDateMonth=='2'){echo "selected";}?>>02</option>
                          <option value="3" <?php if($expDateMonth=='3'){echo "selected";}?>>03</option>
                          <option value="4" <?php if($expDateMonth=='4'){echo "selected";}?>>04</option>
                          <option value="5" <?php if($expDateMonth=='5'){echo "selected";}?>>05</option>
                          <option value="6" <?php if($expDateMonth=='6'){echo "selected";}?>>06</option>
                          <option value="7" <?php if($expDateMonth=='7'){echo "selected";}?>>07</option>
                          <option value="8" <?php if($expDateMonth=='8'){echo "selected";}?>>08</option>
                          <option value="9" <?php if($expDateMonth=='9'){echo "selected";}?>>09</option>
                          <option value="10" <?php if($expDateMonth=='10'){echo "selected";}?>>10</option>
                          <option value="11" <?php if($expDateMonth=='11'){echo "selected";}?>>11</option>
                          <option value="12" <?php if($expDateMonth=='12'){echo "selected";}?>>12</option>
                        </select>
                      </div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Card Expiry Year</div>
                      <div class="form_input">
                        <select name="expDateYear" id="expDateYear" style="width:100px;">
                          <?php 
                    
                    				$curYear = date('Y'); 
                    
                    				for($i=$curYear; $i<$curYear+10;$i++)
                    
                    				{
                    
                    			?>
                          <option value="<?php echo $i;?>" <?php echo($expDateYear==$i)?"selected":""?>><?php echo $i;?></option>
                          <?php
                    
                    				}
                    
                    			?>
                        </select>
                      </div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Card Verification Number:</div>
                      <div class="form_input">
                        <input type="text" size="3" maxlength="4" name="cvv2Number2" style="width:150px;" id="cvv2Number" value="<?=$cvv2Number?>" />
                      </div>
                      <div id="csv" class="error_msg"></div>
                    </div>
                    </li><li>
                    <div class="form_row">
                      <div class="form_label" style="width:200px;">Confirmation E-mail:</div>
                      <div class="form_input">
                        
                        <input type="hidden" name="amount" value="<?php echo $payment_amount?>">
                        <input name="cemail" type="text" id="cemail" size="40"  value=""/>
                        <div id="cemail1" class="error_msg"></div>
                      </div>
                      <input type="hidden" name="orderid" value="<?php echo $orderid?>">
                      <input type="hidden" name="name" value="<?php echo $name?> ">
                      <input type="hidden" name="company" value="<?php echo $company?> ">
                      <input type="hidden" name="telephone" value="<?php echo $telephone?>">
                      <input type="hidden" name="email" value="<?php echo $email?>">
                      <input type="hidden" name="payfor" value="<?php echo $payment_for?>">
                      <input type="hidden" name="country" value="<?php echo $country?>">
                      <input type="hidden" name="paymentType" value="1">
                    </div>
                    </li>
<div class="height10"></div>
<div class="line6"></div>
<li>
                    
                      <input type="submit" name="submit_payment" id="submit_payment" value="SUBMIT PAYMENT"/>
                    </li> 
                </ul>
                <div class="height10"></div>
                <div class="line6"></div>
            </div>
            </div>
            <?php echo form_close();?>
            </div><?php */?>
        </div>
        </div>
        <div class="clear"></div>    
    </div>
</div>

<!--body content ends-->
<?php
$CI->load->library("front/footer_lib");
$CI->footer_lib->display_footer();
?>
<script type="text/javascript">

function validateCard(mon,year){

   CSVNum1=document.getElementById("cvv2Number").value;

  CSVNumFinal=CSVNum1.replace(/^\s+|\s+/,"");

  

  cardNum1=document.getElementById("creditCardNumber").value;

  cardNumFinal=cardNum1.replace(/^\s+|\s+/,"");



if(document.getElementById('creditCardNumber').value=="")

		{

		document.getElementById('creditCardNumber1').innerHTML="**Please enter your Credit Card number**";

	return false;

		}

		

			if (!cardNumFinal.match(/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{14}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/)) {

		document.getElementById('creditCardNumber1').innerHTML="**Please enter Valid Credit Card Number**";

 		document.getElementById("creditCardNumber").select();

		document.getElementById("creditCardNumber").focus();

	return false;

	}

  

  if(document.getElementById("firstName").value==""){

  document.getElementById('firstname1').innerHTML="**Please Enter Your first Name**";

	document.getElementById("firstName").focus();

	return false;

  }

  

  if(document.getElementById("lastName").value==""){

  document.getElementById('lastname1').innerHTML="**Please Enter Your Last Name**";

	document.getElementById("lastName").focus();

	return false;

  }

  



  if(document.getElementById("creditCardType").value=="0"){

  	document.getElementById('creditType').innerHTML="**Please Select Credit Card Type**";

	document.getElementById("creditCardType").focus();

	return false;

  }

if(document.getElementById('straight').checked!=true && document.getElementById('budget').checked!=true)

{

		document.getElementById('budget1').innerHTML="**Please Select any budget type**";

	return false;

}

if(parseInt(document.getElementById("expDateMonth").value) < mon && parseInt(document.getElementById("expDateYear").value)<=year){

  alert("Invalid date specified.");

  document.getElementById("expDateMonth").focus();

  return false;

  }

   

  if(CSVNumFinal==""){

  	document.getElementById('csv').innerHTML="**CSV number field cannot be blank**";

	 //document.getElementById("cvv2Number").focus();

	 return false;

  }

  

 /* if(isNaN(CSVNumFinal) || CSVNumFinal.length!=3){

	  alert("Invalid CSV number");

	  document.getElementById("cvv2Number").select();

	  document.getElementById("cvv2Number").focus();

	  return false;

  }*/

  var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0 -9]{2,4}$/;

  var email_mul=/(([a-zA-Z0-9\-?\.?]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3})(\W?[,;]\W?(?!$))?)+$/i;

   if(document.getElementById('cemail').value=="")

		{

		document.getElementById('cemail1').innerHTML="**Please Enter Confirmation E-mail**";

	return false;

		}	

	if(!document.getElementById('cemail').value.match(emailExp))

	{

		document.getElementById('cemail1').innerHTML="**Please Enter Valid Confirmation E-mail**";

	return false;

		}	

	

  document.getElementById('submit').value="Processing..., please wait";

  document.getElementById('submit').disabled=true;

  

  return true;

}

</script>
<?php
$CI->footer_lib->display_footer_element();

?>